// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   NavControlGroupServiceImpl.java

package com.hfstu.ifs.dataaccess.service.impl;

import com.hfstu.framework.core.orm.Page;
import com.hfstu.framework.core.orm.PageRequest;
import com.hfstu.ifs.dataaccess.dao.INavControlGroupDao;
import com.hfstu.ifs.dataaccess.service.INavControlGroupService;
import com.hfstu.ifs.model.NavControlGroup;
import java.io.Serializable;
import java.util.*;

public class NavControlGroupServiceImpl
	implements INavControlGroupService
{

	private INavControlGroupDao navControlGroupDao;

	public NavControlGroupServiceImpl()
	{
		navControlGroupDao = null;
	}

	public NavControlGroup save(NavControlGroup navControlGroup)
	{
		return (NavControlGroup)navControlGroupDao.save(navControlGroup);
	}

	public NavControlGroup update(NavControlGroup navControlGroup)
	{
		return (NavControlGroup)navControlGroupDao.update(navControlGroup);
	}

	public NavControlGroup saveOrUpdate(NavControlGroup navControlGroup)
	{
		return (NavControlGroup)navControlGroupDao.saveOrUpdate(navControlGroup);
	}

	public void delete(String id)
	{
		navControlGroupDao.delete(id);
	}

	public NavControlGroup getById(String id)
	{
		return (NavControlGroup)navControlGroupDao.getById(id);
	}

	public List getByIds(String ids[])
	{
		return navControlGroupDao.getByIds(ids);
	}

	public void delete(NavControlGroup entity)
	{
		navControlGroupDao.delete(entity);
	}

	public List findAll()
	{
		return navControlGroupDao.findAll();
	}

	public List findListByCondition(Map filterPropertyMap, Map sortValueMap)
	{
		return navControlGroupDao.findListByCondition(filterPropertyMap, sortValueMap);
	}

	public Page findPageByCondition(PageRequest pageRequest, Map filterPropertyMap, Map sortValueMap)
	{
		return navControlGroupDao.findPageByCondition(pageRequest, filterPropertyMap, sortValueMap);
	}

	public void deleteAllById(String id)
	{
		List childrenIds = getAllChildrenId(id);
		if (childrenIds != null && childrenIds.size() != 0)
			navControlGroupDao.deleteByIds((String[])childrenIds.toArray(new String[childrenIds.size()]));
		navControlGroupDao.delete(id);
	}

	public List getAllChildrenId(String id)
	{
		List results = null;
		Map filterPropertyMap = new HashMap();
		filterPropertyMap.put("navControlGroup.parentId", id);
		List list = navControlGroupDao.findListByCondition(filterPropertyMap, null);
		if (list != null && list.size() != 0)
		{
			results = new ArrayList();
			for (Iterator iterator = list.iterator(); iterator.hasNext();)
			{
				NavControlGroup navControlGroup = (NavControlGroup)iterator.next();
				results.add(navControlGroup.getId());
				List childrens = getAllChildrenId(navControlGroup.getId());
				if (childrens != null)
					results.addAll(childrens);
			}

		}
		return results;
	}

	public List getAllParentId(String id)
	{
		List results = null;
		NavControlGroup navControlGroup = (NavControlGroup)navControlGroupDao.getById(id);
		if (navControlGroup != null)
		{
			results = new ArrayList();
			List parentIds = getAllParentId(navControlGroup.getParentId());
			if (parentIds != null)
			{
				results.add(navControlGroup.getParentId());
				results.addAll(parentIds);
			}
		}
		return results;
	}

	public INavControlGroupDao getNavControlGroupDao()
	{
		return navControlGroupDao;
	}

	public void setNavControlGroupDao(INavControlGroupDao navControlGroupDao)
	{
		this.navControlGroupDao = navControlGroupDao;
	}

	public volatile Object getById(Serializable serializable)
	{
		return getById((String)serializable);
	}

	public volatile Object save(Object obj)
	{
		return save((NavControlGroup)obj);
	}

	public volatile Object saveOrUpdate(Object obj)
	{
		return saveOrUpdate((NavControlGroup)obj);
	}

	public volatile void delete(Object obj)
	{
		delete((NavControlGroup)obj);
	}

	public volatile void delete(Serializable serializable)
	{
		delete((String)serializable);
	}

	public volatile List getByIds(Serializable aserializable[])
	{
		return getByIds((String[])aserializable);
	}

	public volatile Object update(Object obj)
	{
		return update((NavControlGroup)obj);
	}
}
